// pages/demo6/generate/index.js
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		question: null,
		entime: false,
		endtime: "",
		day: ""
	},
	onLoad: function(o){
		var question = JSON.parse(o.question);
		this.setData({
			question
		});
	},
	timeChecked: function(e){
		var entime = e.detail;
		if(entime){
			var timestamp = Date.parse(new Date());
			timestamp /= 1000;
			timestamp += 24 * 60 * 60;
			timestamp *= 1000;
			var time = require("./../utils/util.js");
			var day = time.formatTime(new Date(timestamp), true);
			this.setData({
				entime,
				day
			})
		}else{
			this.setData({
				entime,
				endtime: ""
			})
		}
	},
	selectDate: function(e){
		var endtime = e.detail.date;
		var entime = false;
		this.setData({
			endtime,
			entime
		})
	},
	preview: function(e){
		wx.navigateTo({
			url: './../preview/index'
		})
	}
})